package com.ymatou.iapi.prodstock.service;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.prodstock.parameter.LockResult;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

import java.util.List;
/**
*报名审核通过初始化活动库存Call
*FreeMaker Template自动生成代码
*/
public class AuditProductActivityStockCall extends YmatouBaseCall{
	private static String opurl ="/api/Product/AuditProductActivityStock";
	
	public AuditProductActivityStockCall() {
		super(EnvSetup.getSystemUrl("prodstock"),opurl,"POST","JSON");
		//super(EnvSetup.getSystemUrl("productstock_api"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<LockResult> getBatchLockResults(){
		String sLockResult=getJsonObject().get("Data").getAsJsonObject().get("XLoboResult").getAsJsonObject().get("BatchLockResults").getAsJsonArray().toString();
		List<LockResult> BatchLockResultsList=(List<LockResult>)FormatUtil.GSONToObject(sLockResult, new TypeToken<List<LockResult>>(){}.getType());
		return BatchLockResultsList;
	}
}